package com.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dao.AdminDao;
import com.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: T-bao
 * @Date: 2021-3-29 1:15
 * @Description:
 */
@Service
public class UserService extends ServiceImpl<AdminDao, Admin> {

    @Autowired
    private AdminDao userDAO;

    /**
     * 根据用户名查询数量
     * @param uname 用户名
     * @return
     */
    public int countuName(String uname){
        List<Admin> userinfos = userDAO.selectList(new QueryWrapper<Admin>().eq("username" , uname)) ;
        return userinfos.size();
    }
}
